package com.obtk.service.impl;

import com.obtk.mapper.ServerTypeMapper;
import com.obtk.modelSGW.ServerType;
import com.obtk.service.ServerTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("serverType")
public class ServerTypeServiceImpl implements ServerTypeService {
    @Autowired
    private ServerTypeMapper serverTypeMapper;
    @Override
    public List<ServerType> getSerType(ServerType serverType) {
        serverType.setSerStatus(1);
        return serverTypeMapper.getSerType(serverType);
    }
    @Override
    public ServerType selectByType(ServerType serverType) {
        return serverTypeMapper.selectByType(serverType);
    }
    @Override
    public ServerType getServerTypeByType(String serType){
        return serverTypeMapper.getServerTypeByType(serType);
    }
    @Override
    public int registerType(ServerType serverType) {
        serverType.setSerCreateDate(new Date());
        serverType.setSerStatus(1);
        return serverTypeMapper.insert(serverType);
    }
    @Override
    public int updateStatusBatch(String[] serIdsList, Integer status){
        Map<String,Object> params = new HashMap<String,Object>(2);
        params.put("serIdsList",serIdsList);
        params.put("status",status);
        System.out.println(params.get("serIdsList"));
        System.out.println(params.get("status"));
        return serverTypeMapper.updateStatus(params);
    }
    @Override
    public List<ServerType> getServerType(Integer status){
        return serverTypeMapper.getServerType(status);
    }
}